commonlibsse_ng\re\e/
ExtraReferenceHandle.rs1use crate::re::BSExtraData::{BSExtraData, DerivedBSExtraData};
13use crate::re::BSPointerHandle::ObjectRefHandle;
14use crate::re::ExtraDataType::ExtraDataType;
15use crate::re::NiSmartPointer::NiPointer;
16use crate::re::TESObjectREFR::TESObjectREFR;
17use crate::re::offsets_rtti::RTTI_ExtraReferenceHandle;
18use crate::re::offsets_vtable::VTABLE_ExtraReferenceHandle;
19use crate::rel::id::VariantID;
20
21#[repr(C)]
22#[derive(Debug, PartialEq)]
23pub struct ExtraReferenceHandle {
24 pub __base: BSExtraData,
26
27 pub container_ref: ObjectRefHandle,
30
31 pub pad14: u32,
34}
35
36const _: () = {
37 assert!(core::mem::offset_of!(ExtraReferenceHandle, __base) == 0x0);
38 assert!(core::mem::offset_of!(ExtraReferenceHandle, container_ref) == 0x10);
39 assert!(core::mem::offset_of!(ExtraReferenceHandle, pad14) == 0x14);
40 assert!(core::mem::size_of::<ExtraReferenceHandle>() == 0x18);
41};
42
43impl Default for ExtraReferenceHandle {
44 #[inline]
45 fn default() -> Self {
46 Self::new()
47 }
48}
49
50impl DerivedBSExtraData for ExtraReferenceHandle {
51 #[inline]
52 fn get_extra_data(&self) -> &BSExtraData {
53 &self.__base
54 }
55
56 #[inline]
57 fn get_extra_data_type() -> ExtraDataType {
58 Self::EXTRA_DATA_TYPE
59 }
60}
61
62impl ExtraReferenceHandle {
63 pub const RTTI: VariantID = RTTI_ExtraReferenceHandle;
65
66 pub const VTABLE: [VariantID; 1] = VTABLE_ExtraReferenceHandle;
68
69 pub const EXTRA_DATA_TYPE: ExtraDataType = ExtraDataType::ReferenceHandle;
71
72 #[inline]
74 pub const fn new() -> Self {
75 Self { __base: BSExtraData::new(), container_ref: ObjectRefHandle::new(), pad14: 0 }
76 }
77
78 #[inline]
80 pub const fn from_handle(container_ref: ObjectRefHandle) -> Self {
81 Self { __base: BSExtraData::new(), container_ref, pad14: 0 }
82 }
83
84 #[inline]
86 pub const fn get_type(&self) -> ExtraDataType {
87 ExtraDataType::ReferenceHandle
88 }
89
90 #[inline]
92 pub fn is_not_equal(&self, rhs: &Self) -> bool {
93 self.container_ref != rhs.container_ref
94 }
95
96 #[inline]
98 pub fn get_original_reference(&self) -> NiPointer<TESObjectREFR> {
99 self.container_ref.get()
100 }
101}
102
103#[repr(C)]
107#[derive(Debug)]
108pub struct ExtraReferenceHandleVtbl {
109 pub CxxDrop: fn(this: &mut ExtraReferenceHandle),
111
112 pub GetType: fn(this: &ExtraReferenceHandle) -> ExtraDataType,
114
115 pub IsNotEqual: fn(this: &ExtraReferenceHandle, rhs: &ExtraReferenceHandle) -> bool,
117}
118
119impl Default for ExtraReferenceHandleVtbl {
120 #[inline]
121 fn default() -> Self {
122 Self::new()
123 }
124}
125
126impl ExtraReferenceHandleVtbl {
127 pub const fn new() -> Self {
129 const fn CxxDrop(_this: &mut ExtraReferenceHandle) {}
130
131 const fn GetType(_this: &ExtraReferenceHandle) -> ExtraDataType {
132 ExtraReferenceHandle::EXTRA_DATA_TYPE
133 }
134
135 fn IsNotEqual(this: &ExtraReferenceHandle, rhs: &ExtraReferenceHandle) -> bool {
136 this.container_ref != rhs.container_ref
137 }
138
139 Self { CxxDrop, GetType, IsNotEqual }
140 }
141}